home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 September
/
1984-09.d64
/
disk tricks 3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
1KB
|
29 lines
100 sys65517:ifpeek(781)=22thenmt$="":goto2999
110 mt$=""
2998 rem end: rem program 3, unscratch files
2999 printmt$
3000 input "[147]which sector";s$: s=val(s$): if s<0 or s>19 then 3000
3010 print "what is the first byte":print"of the file you wish"
3011 print"to unscratch?"
3020 input bp$: bp=val(bp$): rem input file target byte for unscratch
3030 bs=(bp=2)+(bp=34)+(bp=66)+(bp=98)+(bp=130)+(bp=162)+(bp=194)+(bp=226)
3035 ifbs<>-1then3020:rem reject invalid input
3040 print "select file type:"
3050 print " 1. sequential"
3060 print " 2. program"
3070 print " 3. user"
3080 print " 4. relative"
3090 print "which one?"
3100 get a$: if a$="" then 3100
3110 a=val(a$): if a<1 or a>4 then 3100: rem reject invalid choice
3120 b=a+128: rem set input byte to match dos file codes
3130 open 15,8,15,"i": rem open command channel to disk
3140 open8,8,8,"#": rem open direct access channel to disk
3150 print#15, "u1:"8;0;18;s: rem load sector containing file to be unscratched
3160 print#15, "b-p:"8;bp: rem set buffer pointer to target address
3170 print#8, chr$(b);: rem change target file code in channel 8 buffer
3180 print#15, "u2:"8;0;18;s: rem return changed contents to target sector
3190 close 8: rem close direct access channel
3200 close 15: rem close command channel
3210 rem goto 100: rem restart display t&s program when first rem removed